package com.pig4cloud.pig.village.team.service.impl;

import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.pig4cloud.pig.village.api.dto.TeamSelect;
import com.pig4cloud.pig.village.api.entity.Team;
import com.pig4cloud.pig.village.team.mapper.TeamMapper;
import com.pig4cloud.pig.village.team.service.ITeamService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Service;

import java.util.List;
import java.util.stream.Collectors;

/**
 * @author limbray.li
 * @date 2021/6/26
 */
@Service
@Slf4j
public class TeamServiceImpl extends ServiceImpl<TeamMapper, Team> implements ITeamService {
	@Override
	public List<TeamSelect> listAllSelect() {
		List<Team> list = super.list();
		List<TeamSelect> result = list.stream().map(e -> {
			TeamSelect vo = new TeamSelect();
			vo.setId(e.getId());
			vo.setName(e.getTeamName());
			return vo;
		}).collect(Collectors.toList());
		return result;
	}
}
